package com.seari.vehbaseP.main;

import com.seari.commonutils.common.MiscTools;
import com.seari.commonutils.redis.JedisUtilProxy;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Properties;

@Component
@Order(value = 1)
public class StartUpClass implements ApplicationRunner {

    public static Properties config;
    public static String configFilepath = "config.cfg";

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("start up class loading...");
        JedisUtilProxy.initJedisPoolUtil("127.0.0.1", 6379);
        init();
    }

    private void init()
    {
        try
        {
            config = MiscTools.loadConfig(configFilepath);
        } catch (Exception e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
